package com.google.code.stalkernet.async.io;

import java.nio.ByteBuffer;
import java.nio.channels.Channel;
import java.nio.channels.ReadableByteChannel;

import com.google.code.stalkernet.async.Async;

/**
 * Asynchronous version of {@link ReadableByteChannel} interface.
 *
 * @author Mikhail Vladimirov
 */
public interface AsyncReadableByteChannel extends Async, Channel
{
    /**
     * Asynchronous version of {@link ReadableByteChannel#read(ByteBuffer)}.
     *
     * @param dst The buffer into which bytes are to be transferred
     * @param callback callback to receive asynchronous operation result
     * @return asynchronous operation handle
     */
    public Handle read (ByteBuffer dst, Callback <Integer> callback);
}
